﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Resources;

namespace Presentation
{
	public partial class SmartlistCriteriaField : UserControl
	{
		public int Index;
		public string Field, Criteria, Value, Operator;
		
		public SmartlistCriteriaField()
		{
			InitializeComponent();
		}

		public SmartlistCriteriaField(string _field, string _criteria, string _value, string _operator)
		{
			Field = _field;
			Criteria = _criteria;
			Value = _value;
			Operator = _operator;
			InitializeComponent();
		}

		private void SmartlistCriteriaField_Load(object sender, EventArgs e)
		{
			comboBoxField.Items.Add("Title");
			comboBoxField.Items.Add("Director");
			comboBoxField.Items.Add("Year");
			comboBoxField.Items.Add("Genre");

			comboBoxCondition.Items.Add("contains");
			comboBoxCondition.Items.Add("does not contain");
			comboBoxCondition.Items.Add("is");
			comboBoxCondition.Items.Add("is not");

			comboBoxOperator.Items.Add("AND");
			comboBoxOperator.Items.Add("OR");

			switch (Field)
			{
				case "movie_title":
				default:
					comboBoxField.SelectedIndex = 0;
					break;
				case "movie_director":
					comboBoxField.SelectedIndex = 1;
					break;
				case "movie_year":
					comboBoxField.SelectedIndex = 2;
					break;
				case "movie_genre":
					comboBoxField.SelectedIndex = 3;
					break;
			}

			switch (Criteria)
			{
				case "LIKE":
				default:
					comboBoxCondition.SelectedIndex = 0;
					break;
				case "NOT LIKE":
					comboBoxCondition.SelectedIndex = 1;
					break;
				case "=":
					comboBoxCondition.SelectedIndex = 2;
					break;
				case "!=":
					comboBoxCondition.SelectedIndex = 3;
					break;
			}

			switch (Criteria)
			{
				case "AND":
				default:
					comboBoxOperator.SelectedIndex = 0;
					break;
				case "OR":
					comboBoxOperator.SelectedIndex = 1;
					break;
			}

			textBoxValue.Text = Value;
		}
	}
}
